<?php

$vcp	=	new VC_Parser(10,154);
echo $vcp->transform("The page viewed %c times by %v visitors\n\n");
echo VC_Parser::transform("The page viewed %c times by %v visitors\n");


class VC_Parser {

	public function __construct($views = 1, $visitors = 1, $retConf	=	FALSE) {
		$this->cmdArr	=	array(
			"%c"	=>	$views,
			"%v"	=>	$visitors,
			"%%"	=>	"%"
		);
		
		$this->retConf	=	$retConf;		
	}

	/**
	*	The function transforms the special parameters in the input string into statistics variables
	*	
	*	@param	string	$text	Input text with parameters
	*	@param	array	$cmdArr	Array of substitutions
	*	@return	string
	*/
	public function transform($text = "", $cmdArr	=	NULL) {
		if(is_null($cmdArr))	{
			if(!isset($this))	return $text;	//	If we're not in the object context and substitution array is not specified, return the input string
			$cmdArr	=	$this->cmdArr;
		}
		$text	=	strtr($text, $cmdArr);
		return $text;
	}
}
?>